class right extends eui.Component implements  eui.UIComponent {
	
	//对象编辑面板
	basicbutton:eui.Button
	baseicgroup:eui.Group
	objname:eui.TextInput
	objx:eui.TextInput
	objy:eui.TextInput
	objscalx:eui.TextInput
	objscaly:eui.TextInput
	anchorX:eui.TextInput
	anchorY:eui.TextInput
	rota:eui.TextInput
	level:eui.TextInput
	width1:eui.Label
	height1:eui.Label
    background:eui.ToggleSwitch

    //碰撞编辑面板
    collitorbutton:eui.Button
	collisiongroup:eui.Group
    localx:eui.TextInput
	localy:eui.TextInput
	threepoint:eui.Image
	fourpoint:eui.Image
	fivepoint:eui.Image
	circle:eui.Image
	rect:eui.Image
    collitionswitch:eui.ToggleSwitch
	collitionshow:eui.ToggleSwitch
	collisionname:eui.TextInput
	x1:eui.TextInput
    x2:eui.TextInput
	x3:eui.TextInput
	x4:eui.TextInput
	x5:eui.TextInput
	y1:eui.TextInput
	y2:eui.TextInput
	y3:eui.TextInput
	y4:eui.TextInput
	y5:eui.TextInput
    type:eui.Label
	shapecode:number=0
	collisiontobody:eui.ToggleSwitch


    //play编辑面板
	playbutton:eui.Button
	playgroup:eui.Group
	isplayer:eui.ToggleSwitch
	movespeed:eui.HSlider
	objectname:eui.Label
	camera0:eui.ToggleSwitch
	Yautosort:eui.ToggleSwitch
	script:eui.TextInput
	scriptok:eui.Button;
	scriptlist:eui.List;
	scriptscroller:eui.Scroller;
	scriptremovebutton:eui.Button;
	scriptArr:eui.ArrayCollection;

	//movie编辑面板
	moviebutton:eui.Button
	moviegroup:eui.Group
	moviescroller:eui.Scroller
	movieplay:eui.Button
	loopbutton:eui.Button
	movielist:eui.List
	moviespeed:eui.HSlider
	myCollection:eui.ArrayCollection
	moviejson:any;

	public constructor() {
		super();
	}

	protected partAdded(partName:string,instance:any):void
	{
		super.partAdded(partName,instance);
	}

    protected changeobjbase(e:egret.Event)
	{
	   if(CMainEditor.editor.goal==undefined)return
       if(e.target.name=="objname1")
	   {
		  CMainEditor.editor.objnamechange(CMainEditor.editor.goal.objname,this.objname.text)
          CMainEditor.editor.goal.objname=this.objname.text;
	   }
	   else if(e.target.name=="objx1")
	   {
		  CMainEditor.editor.goal.x=Number(this.objx.text);
	   }
	    else if(e.target.name=="objy1")
		{
          CMainEditor.editor.goal.y=Number(this.objy.text);
		}
		 else if(e.target.name=="objscalx1")
		 {
           CMainEditor.editor.goal.scaleX=Number(this.objscalx.text);
		 }
		  else if(e.target.name=="objscaly1")
		  {
             CMainEditor.editor.goal.scaleY=Number(this.objscaly.text);
		  }
		   else if(e.target.name=="anchorX1")
		   {
             CMainEditor.editor.goal.anchorOffsetX=Number(this.anchorX.text);
		   }
		    else if(e.target.name=="anchorY1")
			{
              CMainEditor.editor.goal.anchorOffsetY=Number(this.anchorY.text);
			}
			 else if(e.target.name=="rota1")
			 {
               CMainEditor.editor.goal.rotation=Number(this.rota.text);
			 }
			  else if(e.target.name=="level1")
			  {
                  CMainEditor.editor.changeGoalIndex(Number(this.level.text))
			  }
			  else if(e.target.name=="background")
			  {
				  CMainEditor.editor.goal.isbackground=this.background.selected;
			  }
			  CObjectEditor.editor.update()
			  CMainEditor.editor.collitionchangetoobject();
	}
	protected changecollision(e:egret.Event)
	{
	 
	   if(CCollitionEditor.editor.goal==undefined)return
	   let target=CCollitionEditor.editor.goal
	   if(e.target.name=="localx")
	   {
		   //计算差值
		 let number=target.shape.x-Number(this.localx.text)
         CCollitionEditor.editor.changegoalpos(number,0);//重新计算储存的点位
		 target.shape.x=Number(this.localx.text)
	   }
	   else if(e.target.name=="localy")
       {
		let number=target.shape.y-Number(this.localy.text)
		 CCollitionEditor.editor.changegoalpos(0,number);
		 target.shape.y=Number(this.localy.text)
	   }
	   else if(e.target.name=="collitionswitch")
	   {
		 if(this.collitionswitch.selected)
		 {
			 CMainEditor.editor.goal.addunjudge_tojudge(target.name)
		 }
		 else
		 {
			 CMainEditor.editor.goal.removejudge_tounjudge(target.name)
		 }
		 CMainEditor.editor.collitionnamechange();
	   }
	   else if(e.target.name=="collitionshow")
	   {
		 target.shapeCollisionSwitch=this.collitionshow.selected;
	   }
	   else if(e.target.name=="collisionname")
       {
		   target.name=this.collisionname.text
		   CMainEditor.editor.collitionnamechange();
	   }
	   else if(e.target.name=="x1")
       {
		   if(target.shapepoint.length<1)return;
		   if(target.judgetype==judgetype.rectangle)return;
		   target.shapepoint[0].x=Number(this.x1.text)
		   CCollitionEditor.editor.changegoalshape()
	   }
	   else if(e.target.name=="x2")
       {
		   if(target.shapepoint.length<2)return;
		   if(target.judgetype==judgetype.circle||target.judgetype==judgetype.rectangle)return;
		    target.shapepoint[1].x=Number(this.x2.text)
			  CCollitionEditor.editor.changegoalshape()
	   }
	   else if(e.target.name=="x3")
       {
		    if(target.shapepoint.length<3)return;
		   if(target.judgetype==judgetype.circle||target.judgetype==judgetype.rectangle)return;
		    target.shapepoint[2].x=Number(this.x3.text)
			  CCollitionEditor.editor.changegoalshape()
	   }
	   	else if(e.target.name=="x4")
       {
		    if(target.shapepoint.length<4)return;
		   if(target.judgetype==judgetype.circle||target.judgetype==judgetype.rectangle)return;
		    target.shapepoint[3].x=Number(this.x4.text)
			  CCollitionEditor.editor.changegoalshape()
	   }
	   else if(e.target.name=="x5")
       {
		      if(target.shapepoint.length<5)return;
		      if(target.judgetype==judgetype.circle||target.judgetype==judgetype.rectangle)return;
		      target.shapepoint[4].x=Number(this.x5.text)
			    CCollitionEditor.editor.changegoalshape()
	   }
	   else if(e.target.name=="y1")
       {
		   if(target.shapepoint.length<1)return;
		   if(target.judgetype==judgetype.circle||target.judgetype==judgetype.rectangle)return;
		    target.shapepoint[0].y=Number(this.y1.text)
			  CCollitionEditor.editor.changegoalshape()
	   }
	   else if(e.target.name=="y2")
       {
		    if(target.shapepoint.length<2)return;
		   if(target.judgetype==judgetype.circle||target.judgetype==judgetype.rectangle)return;
		   target.shapepoint[1].y=Number(this.y2.text)
		     CCollitionEditor.editor.changegoalshape()
	   }
	   else if(e.target.name=="y3")
       {
		    if(target.shapepoint.length<3)return;
		   if(target.judgetype==judgetype.circle||target.judgetype==judgetype.rectangle)return;
		   target.shapepoint[2].y=Number(this.y3.text)
		     CCollitionEditor.editor.changegoalshape()
	   }
	   	else if(e.target.name=="y4")
       {
		       if(target.shapepoint.length<4)return;
		   if(target.judgetype==judgetype.circle||target.judgetype==judgetype.rectangle)return;
		   target.shapepoint[3].y=Number(this.y4.text)
		     CCollitionEditor.editor.changegoalshape()
	   }
	   	else if(e.target.name=="y5")
       {
		       if(target.shapepoint.length<5)return;
		   if(target.judgetype==judgetype.circle||target.judgetype==judgetype.rectangle)return;
		   target.shapepoint[4].y=Number(this.y5.text)
		     CCollitionEditor.editor.changegoalshape()
	   }
	   else if(e.target.name=="collisiontobody")
	   {
		     let a=CCollitionEditor.editor.goal
			  if(a)
			  {
		        if(this.collisiontobody.selected)
		       {
			
                  ASSIST.getASSIST.pushinbodycollsion(a)
		        }
		        else
		        {
                  ASSIST.getASSIST.removeoutbodycollsion(a)
		         }
		  	  }

	   }
	   else if(e.target.name=="scriptok")
	   {
		   
	   }
	   CCollitionEditor.editor.update()
	  
	   CMainEditor.editor.objectchangetocollition();

	
	}
	protected newcollision(e:egret.TouchEvent)
	{
	   let target=CMainEditor.editor.goal
	   if(target==undefined)return;
       if(e.target.name=="threepoint1")
	   {
		  let width=target.width-10
		  let height=target.height-10
		  let p1=new egret.Point(width/2,0);
		  let p2=new egret.Point(0,height);
		  let p3=new egret.Point(width,height);
          target.addbox_polyjudge(false,p1,p2,p3);
		  target.setjudgeshape_show_hide(true);
		  target.setunjudgeshape_show_hide(true);
	   }
	   else if(e.target.name=="fourpoint1")
	   {
		   let width=target.width-10
		   let height=target.height-10
          let p1=new egret.Point(width/4,0);
		  let p2=new egret.Point(0,height);
		  let p3=new egret.Point(width-width/4,height);
		  let p4=new egret.Point(width,0);
          target.addbox_polyjudge(false,p1,p2,p3,p4);
		  target.setjudgeshape_show_hide(true);
		  target.setunjudgeshape_show_hide(true);
	   }
	    else if(e.target.name=="fivepoint1")
	   {
		  let r=target.width>target.height?target.height:target.width;
		  r-=10;
		  r/=2;
		  let x=target.width/2;
		  let y=target.height/2;
		  let angle=18;
		  let p1=new egret.Point(Math.cos(angle*Math.PI/180)*r+x,Math.sin(angle*Math.PI/180)*r+y);
		  angle+=72;
		  let p2=new egret.Point(Math.cos(angle*Math.PI/180)*r+x,Math.sin(angle*Math.PI/180)*r+y);
		  angle+=72;
		  let p3=new egret.Point(Math.cos(angle*Math.PI/180)*r+x,Math.sin(angle*Math.PI/180)*r+y);
		  angle+=72;
		  let p4=new egret.Point(Math.cos(angle*Math.PI/180)*r+x,Math.sin(angle*Math.PI/180)*r+y);
		  angle+=72;
		  let p5=new egret.Point(Math.cos(angle*Math.PI/180)*r+x,Math.sin(angle*Math.PI/180)*r+y);
          target.addbox_polyjudge(false,p1,p2,p3,p4,p5);
		  target.setjudgeshape_show_hide(true);
		  target.setunjudgeshape_show_hide(true);
	   }
	    else if(e.target.name=="rect1")
	   {
		  target.addbox_rectjudge(false,target.width/2,target.height/2,target.width-10,target.height-10);
		 
		  target.setjudgeshape_show_hide(true);
		  target.setunjudgeshape_show_hide(true);
	   }
	    else if(e.target.name=="circle1")
	   {
		  let r=target.width>target.height?target.height:target.width
		  r-=10
		  r/=2
		  target.addbox_circlejudge(false,target.width/2,target.height/2,r);
		  target.setjudgeshape_show_hide(true);
		  target.setunjudgeshape_show_hide(true);
	   }
	   //设置属性
	    CCollitionEditor.editor.goal=target.unjudge[target.unjudge.length-1]
		target.unjudge[target.unjudge.length-1].shape.touchEnabled=true;

		target.unjudge[target.unjudge.length-1].shape.name="itsajudgeshape_"+CBASE_MANAGE.getCBASE_MANAGE.colltionnamecount++;
		
	
		CMainEditor.editor.objectchangetocollition();
		CMainEditor.editor.collitionnamechange();
		CMainEditor.editor.changetreeselectBycollition(target.unjudge[target.unjudge.length-1]);
	
	}
	protected playercollision(e:egret.Event|egret.TouchEvent)
	{
        if(e.target.name=="isplayer")
	   {
		  
		   if(CMainEditor.editor.goal==undefined)return;
		   let target=CMainEditor.editor.goal
		    if(this.isplayer.selected)
			{
				target.setplayer();
			}
			else 
			{
				target.cancleplayer();
			}
	   }
	   else if(e.target.name=="movespeed")
	   {
          ASSIST.getASSIST.speed=this.movespeed.value
	   }
	   else if(e.target.name=="scriptok")
	   {
          if(this.script.text&&CMainEditor.editor.goal)
		  {
			  ASSIST.getASSIST.pushinscript(CMainEditor.editor.goal,this.script.text);
			  this.scriptlistupdata();
		  }
	   }
	   else if(e.target.name=="scriptremovebutton")
	   {
            if(this.scriptlist.selectedItem&&CMainEditor.editor.goal)
		  {
			  ASSIST.getASSIST.removescript(CMainEditor.editor.goal,this.scriptlist.selectedItem);
			    this.scriptlistupdata();
		  }
	   }
	   else if(e.target.name=="camera")
	   {
         ASSIST.getASSIST.camerafollow=this.camera0.selected
		
	   }
	   else if(e.target.name=="Yautosort")
	   {
         ASSIST.getASSIST.Yautosor=this.Yautosort.selected
	   }
	}
	protected changemovie(e:egret.TouchEvent|egret.Event)
	{
	
		if(e.target.name=="movieplay")
		{
			if(this.movielist.selectedItem)
            CMainEditor.editor.goal.gotoandplay(this.movielist.selectedItem);
		}
		else if(e.target.name=="loopbutton")
		{
			CMainEditor.editor.goal.gotoandplay_loop(this.movielist.selectedItem);
		}
		else if(e.target.name=="moviespeed")
		{
			if(this.movielist.selectedItem)
			CMainEditor.editor.goal.SETmoviespeed(this.moviespeed.value)
		}

	}
	public changetoCollition()
	{
       	   this.baseicgroup.visible=false
			this.playgroup.visible=false
			this.collisiongroup.visible=true
		     this.moviegroup.visible=false;
			CMainEditor.editor.objectchangetocollition();
	}
	public changetoCobject()
	{
      	   this.baseicgroup.visible=true
			this.playgroup.visible=false
			this.collisiongroup.visible=false;
			this.moviegroup.visible=false;
		    CMainEditor.editor.collitionchangetoobject();
	}
	protected childrenCreated():void
	{
		   super.childrenCreated();
		  this.addEventListener(eui.UIEvent.COMPLETE, ()=>{}, this);

		   var shap:egret.Shape=new egret.Shape
		   shap.graphics.beginFill(808080,1)
		   shap.graphics.lineStyle(10)
		   shap.graphics.drawRect(0,0,this.width,this.height);
		   shap.graphics.endFill();
		   this.addChildAt(shap,0)
		   
		   this.playbutton.addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{
			this.baseicgroup.visible=false
			this.playgroup.visible=true
			this.collisiongroup.visible=false;
			this.moviegroup.visible=false;
		
		   },this);
		this.moviebutton.addEventListener
		(egret.TouchEvent.TOUCH_TAP,()=>{
			this.baseicgroup.visible=false
			this.playgroup.visible=false
			this.collisiongroup.visible=false;
			this.moviegroup.visible=true;
			this.movieupdata();
		
		   },this);
		this.basicbutton.addEventListener(egret.TouchEvent.TOUCH_TAP,this.changetoCobject,this);
		this.collitorbutton.addEventListener(egret.TouchEvent.TOUCH_TAP,this.changetoCollition,this);
	    
		this.basicgroupseup();
		this.collitiongroupsetup();
		this.playgroupsetup();
		this.beginlisten();
		this.moviegroupsetup();
		this.baseicgroup.visible=true;
		this.playgroup.visible=true;
		this.collisiongroup.visible=true;
		this.moviegroup.visible=true;

		this.baseicgroup.visible=true;
		this.playgroup.visible=false;
		this.collisiongroup.visible=false;
		this.moviegroup.visible=false;
		
	}

	public clear()
	{
		this.objname.textDisplay.text="";
		this.objx.textDisplay.text="";
		this.objy.textDisplay.text="";
		this.objscalx.textDisplay.text="";
		this.objscaly.textDisplay.text="";
		this.anchorX.textDisplay.text="";
		this.anchorY.textDisplay.text="";
		this.rota.textDisplay.text="";
		this.level.textDisplay.text="";

		this.localx.textDisplay.text="";
	    this.localy.textDisplay.text="";
	    this.collisionname.textDisplay.text="";
	    this.x1.textDisplay.text="";
	    this.y1.textDisplay.text="";
        this.x2.textDisplay.text="";
		this.y2.textDisplay.text="";
		this.x3.textDisplay.text="";
		this.y3.textDisplay.text=""	;
        this.x4.textDisplay.text="";
		this.y4.textDisplay.text="";
        this.x5.textDisplay.text="";
		this.y5.textDisplay.text="";
		this.script.textDisplay.text="";
			

		this.myCollection.removeAll();
	}
	public update()
	{
	  if(!CCollitionEditor.editor.state) //对象数据更新
	  {
		let a=CMainEditor.editor.goal
		if(a==undefined)return;
		
		this.objname.prompt=a.objname
		this.objx.prompt=String(a.x)
		this.objy.prompt=String(a.y)
		this.objscalx.prompt=String(a.scaleX)
		this.objscaly.prompt=String(a.scaleY)
		this.anchorX.prompt=String(a.anchorOffsetX)
		this.anchorY.prompt=String(a.anchorOffsetY)
		this.rota.prompt=String(a.rotation)
		this.level.prompt=String(CMainEditor.editor.getgoalAt)
		this.width1.text=String(a.width)
		this.height1.text=String(a.height)
		this.background.selected=a.background
	  }
	  else{    //碰撞体数据更新
		  	let a=CCollitionEditor.editor.goal
		    if(a==undefined)return;


			 this.localx.prompt=String(a.shape.x)
	         this.localy.prompt=String(a.shape.y)
	      
            this.collitionswitch.selected=a.judgeswitch
			this.collitionshow.selected=a.shape.alpha>0?true:false
	        this.collisionname.prompt=a.name
			this.collisiontobody.selected=ASSIST.getASSIST.checkbodycollision(a);
			switch(a.judgetype)
			{
				case judgetype.circle:this.type.text="circle"; break;
				case judgetype.rectangle:this.type.text="rect";break;
				case judgetype.poly:
				{
					switch(a.shapepoint.length)
					{
						case 3:this.type.text="3point_poly";break;
						case 4:this.type.text="4point_poly";break;
						case 5:this.type.text="5point_poly";break;
					}
				}break;
			}
			if(a.shapepoint.length>=1)
			{
			this.x1.prompt=String(a.shapepoint[0].x)
			this.y1.prompt=String(a.shapepoint[0].y)
			}
			if(a.shapepoint.length>=3)
			{
              this.x2.prompt=String(a.shapepoint[1].x)
			  this.y2.prompt=String(a.shapepoint[1].y)
			  this.x3.prompt=String(a.shapepoint[2].x)
			  this.y3.prompt=String(a.shapepoint[2].y)
			}
			if(a.shapepoint.length>=4)
			{
              this.x4.prompt=String(a.shapepoint[3].x)
			  this.y4.prompt=String(a.shapepoint[3].y)
			
			}
			if(a.shapepoint.length==5)
			{
              this.x5.prompt=String(a.shapepoint[4].x)
			  this.y5.prompt=String(a.shapepoint[4].y)
			
			}
	  }

	  //play选项更新
	  if(CMainEditor.editor.goal!=undefined)
	  {
         this.isplayer.selected=(CMainEditor.editor.goal==ASSIST.getASSIST.player);
		  this.objectname.text=CMainEditor.editor.goal.objname;
	  }
	 this.movespeed.value=ASSIST.getASSIST.speed;
	 this.camera0.selected=ASSIST.getASSIST.camerafollow;
	 this.Yautosort.selected=ASSIST.getASSIST.Yautosor;

	 
	}
	public movieupdata()
	{
		this.myCollection.removeAll();
		if(CMainEditor.editor.goal==undefined)return;
		if(CMainEditor.editor.goal.resnmae==undefined)return;
		let name=CMainEditor.editor.goal.resnmae.split("/")
		if(name[1]=="json")
	    {
			var joson=RES.getRes(name[0]+"_json")
			
			this.findmoviejson(joson)
			
			
          	for(let a=0;a<this.moviejson.length;a++)
			{
				   this.myCollection.addItem(this.moviejson[a].name)
			}
		}
	
	}
	public scriptlistupdata()
	{
		this.scriptArr.removeAll();
		let a=ASSIST.getASSIST.getscriptlist(CMainEditor.editor.goal)
		for(let v=0;v<a.length;v++)
		{
			this.scriptArr.addItem(a[v]);
		}
	}
	private findmoviejson(a:any)
	{
	  
		 Object.keys(a).forEach(function(key1){
			 
             if(key1!="0"&&key1!="labels")
			 {
				// console.log("!=labels ",key1)
				this.findmoviejson(a[key1])
			 }
			 else if(key1=="0")
			 {
				// console.log("return ",key1)
				 return;
			 }
			 else if(key1=="labels")
			 {
				// console.log("findlabels ",key1)
				this.moviejson=a[key1];
				
				 return;
			 }
		}.bind(this));
	
	}
	private basicgroupseup()
	{
	 	this.objname.textDisplay.name="objname1"
		this.objx.textDisplay.name="objx1"
		this.objy.textDisplay.name="objy1"
		this.objscalx.textDisplay.name="objscalx1"
		this.objscaly.textDisplay.name="objscaly1"
		this.anchorX.textDisplay.name="anchorX1"
		this.anchorY.textDisplay.name="anchorY1"
		this.rota.textDisplay.name="rota1"
		this.level.textDisplay.name="level1"
		this.background.name="background"
	
	}
	private collitiongroupsetup()
	{
  
     this.localx.textDisplay.name="localx"
	
	 this.localy.textDisplay.name="localy"
	 this.threepoint.name="threepoint1"
	 this.fourpoint.name="fourpoint1"
	 this.fivepoint.name="fivepoint1"
	 this.circle.name="circle1"
	 this.rect.name="rect1"
     this.collitionswitch.name="collitionswitch"
	 this.collisionname.textDisplay.name="collisionname"
	 this.x1.textDisplay.name="x1"
     this.x2.textDisplay.name="x2"
	 this.x3.textDisplay.name="x3"
	 this.x4.textDisplay.name="x4"
	 this.x5.textDisplay.name="x5"
	 this.y1.textDisplay.name="y1"
	 this.y2.textDisplay.name="y2"
	 this.y3.textDisplay.name="y3"
	 this.y4.textDisplay.name="y4"
	 this.y5.textDisplay.name="y5"
	 this.type.name="type"
	 this.collitionshow.name="collitionshow"
	 this.collisiontobody.name="collisiontobody"

	
	}

	private playgroupsetup()
	{
	
	 this.isplayer.name="isplayer"
	 this.movespeed.name="movespeed"
	 this.objectname.name="objectname"
	 this.scriptlist.name="scriptlist"
	 this.scriptscroller.name="scriptscroller"
     this.scriptremovebutton.name="scriptremovebutton"

        this.scriptscroller.viewport=this.scriptlist
	    var a=[]
		this.scriptArr= new eui.ArrayCollection(a);
        this.scriptlist.dataProvider=this.scriptArr;

	 this.camera0.name="camera"
	 this.Yautosort.name="Yautosort"
     this.movespeed.minimum = 1;//定义最小值
     this.movespeed.maximum = 20;//定义最大值
     this.movespeed.value =1;//定义默认值
	 this.script.textDisplay.name="script"
	 this.scriptok.name="scriptok";
       
	} 
	private moviegroupsetup()
	{
	  this.moviebutton.name="moviebutton"

	  this.movieplay.name="movieplay"
	  this.loopbutton.name="loopbutton"
	  this.moviespeed.name="moviespeed"
	  this.moviescroller.viewport=this.movielist
	    var a=[]
		this.myCollection= new eui.ArrayCollection(a);
        this.movielist.dataProvider=this.myCollection;
		this.moviespeed.maximum=10
		this.moviespeed.minimum=1
		this.movespeed.value=1
	}
	public beginlisten()
	{
		//play面板
        this.isplayer.addEventListener(egret.Event.CHANGE,this.playercollision,this);
	    this.movespeed.addEventListener(egret.Event.CHANGE,this.playercollision,this);
	    this.camera0.addEventListener(egret.Event.CHANGE,this.playercollision,this);
	    this.Yautosort.addEventListener(egret.Event.CHANGE,this.playercollision,this);
		this.scriptok.addEventListener(egret.TouchEvent.TOUCH_TAP,this.playercollision,this);
		this.scriptremovebutton.addEventListener(egret.TouchEvent.TOUCH_TAP,this.playercollision,this);

     //碰撞面板
	 this.localx.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.localy.addEventListener(egret.Event.CHANGE,this.changecollision,this);
     this.collitionswitch.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.collitionshow.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.collisionname.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.x1.addEventListener(egret.Event.CHANGE,this.changecollision,this);
     this.x2.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.x3.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.x4.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.x5.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.y1.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.y2.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.y3.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.y4.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.y5.addEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.collisiontobody.addEventListener(egret.Event.CHANGE,this.changecollision,this);


	 this.threepoint.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.newcollision,this);
	 this.fourpoint.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.newcollision,this);
	 this.fivepoint.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.newcollision,this);
	 this.circle.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.newcollision,this);
	 this.rect.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.newcollision,this);

        //对象面板
		this.objname.addEventListener(egret.Event.CHANGE,this.changeobjbase,this);	
		this.objx.addEventListener(egret.Event.CHANGE,this.changeobjbase,this);	
		this.objy.addEventListener(egret.Event.CHANGE,this.changeobjbase,this);	
		this.objscalx.addEventListener(egret.Event.CHANGE,this.changeobjbase,this);
		this.objscaly.addEventListener(egret.Event.CHANGE,this.changeobjbase,this);	
		this.anchorX.addEventListener(egret.Event.CHANGE,this.changeobjbase,this);	
		this.anchorY.addEventListener(egret.Event.CHANGE,this.changeobjbase,this);
		this.rota.addEventListener(egret.Event.CHANGE,this.changeobjbase,this);
		this.level.addEventListener(egret.Event.CHANGE,this.changeobjbase,this);
        this.background.addEventListener(egret.Event.CHANGE,this.changeobjbase,this);

		//movie面板
		 this.movieplay.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.changemovie,this);
	     this.loopbutton.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.changemovie,this);
		 this.movielist.addEventListener(egret.Event.CHANGE,this.changemovie,this);
		 this.moviespeed.addEventListener(egret.Event.CHANGE,this.changemovie,this);

	}
	public stoplisten()
	{
		//play面板
		this.isplayer.removeEventListener(egret.Event.CHANGE,this.playercollision,this);
	    this.movespeed.removeEventListener(egret.Event.CHANGE,this.playercollision,this);
        this.camera0.removeEventListener(egret.Event.CHANGE,this.playercollision,this);
	    this.Yautosort.removeEventListener(egret.Event.CHANGE,this.playercollision,this);
		this.scriptok.removeEventListener(egret.Event.CHANGE,this.playercollision,this);
		this.scriptremovebutton.removeEventListener(egret.Event.CHANGE,this.playercollision,this);


     //碰撞面板
	 this.localx.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.localy.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
     this.collitionswitch.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.collitionshow.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.collisionname.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.x1.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
     this.x2.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.x3.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.x4.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.x5.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.y1.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.y2.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.y3.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.y4.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.y5.removeEventListener(egret.Event.CHANGE,this.changecollision,this);
	 this.collisiontobody.removeEventListener(egret.Event.CHANGE,this.changecollision,this);


      //对象面板
	 this.threepoint.removeEventListener(egret.TouchEvent.TOUCH_BEGIN,this.newcollision,this);
	 this.fourpoint.removeEventListener(egret.TouchEvent.TOUCH_BEGIN,this.newcollision,this);
	 this.fivepoint.removeEventListener(egret.TouchEvent.TOUCH_BEGIN,this.newcollision,this);
	 this.circle.removeEventListener(egret.TouchEvent.TOUCH_BEGIN,this.newcollision,this);
	 this.rect.removeEventListener(egret.TouchEvent.TOUCH_BEGIN,this.newcollision,this);
     this.background.removeEventListener(egret.Event.CHANGE,this.changeobjbase,this);


         //对象面板
		this.objname.removeEventListener(egret.Event.CHANGE,this.changeobjbase,this);	
		this.objx.removeEventListener(egret.Event.CHANGE,this.changeobjbase,this);	
		this.objy.removeEventListener(egret.Event.CHANGE,this.changeobjbase,this);	
		this.objscalx.removeEventListener(egret.Event.CHANGE,this.changeobjbase,this);
		this.objscaly.removeEventListener(egret.Event.CHANGE,this.changeobjbase,this);	
		this.anchorX.removeEventListener(egret.Event.CHANGE,this.changeobjbase,this);	
		this.anchorY.removeEventListener(egret.Event.CHANGE,this.changeobjbase,this);
		this.rota.removeEventListener(egret.Event.CHANGE,this.changeobjbase,this);
		this.level.removeEventListener(egret.Event.CHANGE,this.changeobjbase,this);

	 //movie面板
	    this.movieplay.removeEventListener(egret.TouchEvent.TOUCH_BEGIN,this.changemovie,this);
	    this.loopbutton.removeEventListener(egret.TouchEvent.TOUCH_BEGIN,this.changemovie,this);
		this.movielist.removeEventListener(egret.Event.CHANGE,this.changemovie,this);
		this.moviespeed.removeEventListener(egret.Event.CHANGE,this.changemovie,this);
	}
}